/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package factory;

import com.jme3.light.AmbientLight;
import com.jme3.light.DirectionalLight;
import com.jme3.light.Light;
import com.jme3.light.PointLight;
import com.jme3.light.SpotLight;
import com.jme3.math.ColorRGBA;
import com.jme3.math.FastMath;
import com.jme3.math.Vector3f;
import java.util.logging.Logger;

/**
 *
 * @author matthias
 */
public class LightFactory {

    // Logger
    private static final Logger logger = Logger.getLogger(LightFactory.class.getName());
    
    public static Light createAmbientLight(ColorRGBA color, String name) {
        AmbientLight light = new AmbientLight();
        light.setColor(color);
        light.setName(name);
        return light;
    }

    public static Light createPointLight(Vector3f position, float radius, ColorRGBA color, String name) {
        PointLight light = new PointLight();
        light.setPosition(new Vector3f(position));
        light.setRadius(radius);
        light.setColor(color);
        light.setName(name);
        return light;
    }

    public static DirectionalLight createDirectionalLight(Vector3f direction, ColorRGBA color, String name) {
        DirectionalLight light = new DirectionalLight();
        light.setDirection(new Vector3f(direction).normalizeLocal());
        light.setColor(color);
        light.setName(name);
        return light;
    }

    public static SpotLight createSpotLight(Vector3f position, Vector3f direction,
            float spotRange, float innerAngle, float outerAngle, ColorRGBA color, String name) {

        SpotLight light = new SpotLight();
        light.setPosition(position);
        light.setDirection(direction);
        light.setSpotRange(spotRange);
        light.setSpotInnerAngle(innerAngle * FastMath.DEG_TO_RAD);
        light.setSpotOuterAngle(outerAngle * FastMath.DEG_TO_RAD);
        light.setColor(color);
        light.setName(name);

        return light;
    }
}
